diff --git a/misc/BreCalApi.cs b/misc/BreCalApi.cs
index 1fd1fe8..df88d8c 100644
--- a/misc/BreCalApi.cs
+++ b/misc/BreCalApi.cs
@@ -5507,9 +5507,10 @@ namespace BreCalClient.misc.Model
/// lastName.
/// userName.
/// userPhone.
+ /// userEmail.
/// exp.
/// token.
- public LoginResult(int id = default(int), int participantId = default(int), string firstName = default(string), string lastName = default(string), string userName = default(string), string userPhone = default(string), float exp = default(float), string token = default(string))
+ public LoginResult(int id = default(int), int participantId = default(int), string firstName = default(string), string lastName = default(string), string userName = default(string), string userPhone = default(string), string userEmail = default(string), float exp = default(float), string token = default(string))
{
this.Id = id;
this.ParticipantId = participantId;
@@ -5517,6 +5518,7 @@ namespace BreCalClient.misc.Model
this.LastName = lastName;
this.UserName = userName;
this.UserPhone = userPhone;
+ this.UserEmail = userEmail;
this.Exp = exp;
this.Token = token;
}
@@ -5551,6 +5553,11 @@ namespace BreCalClient.misc.Model
[DataMember(Name = "user_phone", EmitDefaultValue = true)]
public string UserPhone { get; set; }
///
+ /// Gets or Sets UserEmail
+ ///
+ [DataMember(Name = "user_email", EmitDefaultValue = true)]
+ public string UserEmail { get; set; }
+ ///
/// Gets or Sets Exp
///
[DataMember(Name = "exp", EmitDefaultValue = true)]
@@ -5574,6 +5581,7 @@ namespace BreCalClient.misc.Model
sb.Append(" LastName: ").Append(LastName).Append("\n");
sb.Append(" UserName: ").Append(UserName).Append("\n");
sb.Append(" UserPhone: ").Append(UserPhone).Append("\n");
+ sb.Append(" UserEmail: ").Append(UserEmail).Append("\n");
sb.Append(" Exp: ").Append(Exp).Append("\n");
sb.Append(" Token: ").Append(Token).Append("\n");
sb.Append("}\n");
@@ -5636,6 +5644,11 @@ namespace BreCalClient.misc.Model
(this.UserPhone != null &&
this.UserPhone.Equals(input.UserPhone))
) &&
+ (
+ this.UserEmail == input.UserEmail ||
+ (this.UserEmail != null &&
+ this.UserEmail.Equals(input.UserEmail))
+ ) &&
(
this.Exp == input.Exp ||
this.Exp.Equals(input.Exp)
@@ -5673,6 +5686,10 @@ namespace BreCalClient.misc.Model
{
hashCode = (hashCode * 59) + this.UserPhone.GetHashCode();
}
+ if (this.UserEmail != null)
+ {
+ hashCode = (hashCode * 59) + this.UserEmail.GetHashCode();
+ }
hashCode = (hashCode * 59) + this.Exp.GetHashCode();
if (this.Token != null)
{
@@ -7627,7 +7644,8 @@ namespace BreCalClient.misc.Model
/// firstName.
/// lastName.
/// userPhone.
- public UserDetails(int id = default(int), string oldPassword = default(string), string newPassword = default(string), string firstName = default(string), string lastName = default(string), string userPhone = default(string))
+ /// userEmail.
+ public UserDetails(int id = default(int), string oldPassword = default(string), string newPassword = default(string), string firstName = default(string), string lastName = default(string), string userPhone = default(string), string userEmail = default(string))
{
this.Id = id;
this.OldPassword = oldPassword;
@@ -7635,6 +7653,7 @@ namespace BreCalClient.misc.Model
this.FirstName = firstName;
this.LastName = lastName;
this.UserPhone = userPhone;
+ this.UserEmail = userEmail;
}
///
/// Gets or Sets Id
@@ -7667,6 +7686,11 @@ namespace BreCalClient.misc.Model
[DataMember(Name = "user_phone", EmitDefaultValue = true)]
public string UserPhone { get; set; }
///
+ /// Gets or Sets UserEmail
+ ///
+ [DataMember(Name = "user_email", EmitDefaultValue = true)]
+ public string UserEmail { get; set; }
+ ///
/// Returns the string presentation of the object
///
/// String presentation of the object
@@ -7680,6 +7704,7 @@ namespace BreCalClient.misc.Model
sb.Append(" FirstName: ").Append(FirstName).Append("\n");
sb.Append(" LastName: ").Append(LastName).Append("\n");
sb.Append(" UserPhone: ").Append(UserPhone).Append("\n");
+ sb.Append(" UserEmail: ").Append(UserEmail).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
@@ -7740,6 +7765,11 @@ namespace BreCalClient.misc.Model
this.UserPhone == input.UserPhone ||
(this.UserPhone != null &&
this.UserPhone.Equals(input.UserPhone))
+ ) &&
+ (
+ this.UserEmail == input.UserEmail ||
+ (this.UserEmail != null &&
+ this.UserEmail.Equals(input.UserEmail))
);
}
///
@@ -7772,6 +7802,10 @@ namespace BreCalClient.misc.Model
{
hashCode = (hashCode * 59) + this.UserPhone.GetHashCode();
}
+ if (this.UserEmail != null)
+ {
+ hashCode = (hashCode * 59) + this.UserEmail.GetHashCode();
+ }
return hashCode;
}
}
diff --git a/misc/BreCalApi.yaml b/misc/BreCalApi.yaml
index 82a36d0..738816a 100644
--- a/misc/BreCalApi.yaml
+++ b/misc/BreCalApi.yaml
@@ -696,6 +696,8 @@ components:
type: string
user_phone:
type: string
+ user_email:
+ type: string
exp:
type: number
format: float
@@ -723,6 +725,9 @@ components:
user_phone:
type: string
nullable: true
+ user_email:
+ type: string
+ nullable: true
Id:
type: object
description: A unique identifier for an entity
diff --git a/src/BreCalClient/AboutDialog.xaml b/src/BreCalClient/AboutDialog.xaml
index b14d21f..da82547 100644
--- a/src/BreCalClient/AboutDialog.xaml
+++ b/src/BreCalClient/AboutDialog.xaml
@@ -7,7 +7,7 @@
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:p = "clr-namespace:BreCalClient.Resources"
mc:Ignorable="d"
- Title="Help" Height="280" Width="500">
+ Title="Help" Height="374" Width="500" Loaded="Window_Loaded">
@@ -20,6 +20,10 @@
+
+
+
+
@@ -39,14 +43,20 @@
-
-
-
-
-
-
+
+
+
+
+
-
+
+
+
+
+
+
+
+
diff --git a/src/BreCalClient/AboutDialog.xaml.cs b/src/BreCalClient/AboutDialog.xaml.cs
index 61e6154..5347b22 100644
--- a/src/BreCalClient/AboutDialog.xaml.cs
+++ b/src/BreCalClient/AboutDialog.xaml.cs
@@ -2,6 +2,7 @@
// Description: Show about info and allow user detail editing
//
+using BreCalClient.misc.Model;
using System;
using System.Diagnostics;
using System.Windows;
@@ -24,6 +25,12 @@ namespace BreCalClient
#endregion
+ #region Properties
+
+ public LoginResult? LoginResult { get; set; }
+
+ #endregion
+
#region events
public event Action? ChangePasswordRequested;
@@ -39,6 +46,12 @@ namespace BreCalClient
private void buttonChangePassword_Click(object sender, RoutedEventArgs e)
{
+ if (this.LoginResult != null)
+ {
+ this.LoginResult.UserPhone = this.textBoxUserPhone.Text.Trim();
+ this.LoginResult.UserEmail = this.textBoxUserEmail.Text.Trim();
+ }
+
this.ChangePasswordRequested?.Invoke(this.wpBoxOldPassword.Password, this.wpBoxNewPassword.Password);
}
@@ -56,9 +69,17 @@ namespace BreCalClient
(this.wpBoxNewPasswordRepeat.Password.Length > 0) &&
this.wpBoxNewPassword.Password.Equals(this.wpBoxNewPasswordRepeat.Password) &&
(!this.wpBoxNewPassword.Password.Equals(this.wpBoxOldPassword.Password));
+ }
+
+ private void Window_Loaded(object sender, RoutedEventArgs e)
+ {
+ if(LoginResult != null)
+ {
+ this.textBoxUserEmail.Text = LoginResult.UserEmail;
+ this.textBoxUserPhone.Text = LoginResult.UserPhone;
+ }
}
#endregion
-
}
}
diff --git a/src/BreCalClient/MainWindow.xaml.cs b/src/BreCalClient/MainWindow.xaml.cs
index 582d65d..e5f21ea 100644
--- a/src/BreCalClient/MainWindow.xaml.cs
+++ b/src/BreCalClient/MainWindow.xaml.cs
@@ -192,6 +192,7 @@ namespace BreCalClient
private void buttonInfo_Click(object sender, RoutedEventArgs e)
{
AboutDialog ad = new();
+ ad.LoginResult = this._loginResult;
ad.ChangePasswordRequested += async (oldPw, newPw) =>
{
if (_loginResult != null)
@@ -202,6 +203,7 @@ namespace BreCalClient
FirstName = _loginResult.FirstName,
LastName = _loginResult.LastName,
UserPhone = _loginResult.UserPhone,
+ UserEmail = _loginResult.UserEmail,
OldPassword = oldPw,
NewPassword = newPw
};
diff --git a/src/BreCalClient/Resources/Resources.Designer.cs b/src/BreCalClient/Resources/Resources.Designer.cs
index 66aadc9..d020a2a 100644
--- a/src/BreCalClient/Resources/Resources.Designer.cs
+++ b/src/BreCalClient/Resources/Resources.Designer.cs
@@ -346,6 +346,15 @@ namespace BreCalClient.Resources {
}
}
+ ///
+ /// Looks up a localized string similar to Update contact info.
+ ///
+ public static string textChangeContactInfo {
+ get {
+ return ResourceManager.GetString("textChangeContactInfo", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Change password.
///
@@ -436,6 +445,15 @@ namespace BreCalClient.Resources {
}
}
+ ///
+ /// Looks up a localized string similar to E-mail.
+ ///
+ public static string textEmail {
+ get {
+ return ResourceManager.GetString("textEmail", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Enter keyword.
///
@@ -661,6 +679,15 @@ namespace BreCalClient.Resources {
}
}
+ ///
+ /// Looks up a localized string similar to Phone.
+ ///
+ public static string textPhone {
+ get {
+ return ResourceManager.GetString("textPhone", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Pier side.
///
diff --git a/src/BreCalClient/Resources/Resources.de.resx b/src/BreCalClient/Resources/Resources.de.resx
index 5606ede..5dbb002 100644
--- a/src/BreCalClient/Resources/Resources.de.resx
+++ b/src/BreCalClient/Resources/Resources.de.resx
@@ -406,4 +406,13 @@
Breite
+
+ Kontaktdaten bearbeiten
+
+
+ E-Mail
+
+
+ Telefon
+
\ No newline at end of file
diff --git a/src/BreCalClient/Resources/Resources.resx b/src/BreCalClient/Resources/Resources.resx
index 1bad839..add0c1f 100644
--- a/src/BreCalClient/Resources/Resources.resx
+++ b/src/BreCalClient/Resources/Resources.resx
@@ -208,6 +208,9 @@
Change
+
+ Update contact info
+
Change password
@@ -238,6 +241,9 @@
Edit times
+
+ E-mail
+
Enter keyword
@@ -313,6 +319,9 @@
Password changed.
+
+ Phone
+
Pier side
diff --git a/src/server/BreCal/impl/login.py b/src/server/BreCal/impl/login.py
index c8c7e8d..5f1847b 100644
--- a/src/server/BreCal/impl/login.py
+++ b/src/server/BreCal/impl/login.py
@@ -26,7 +26,8 @@ def GetUser(options):
"first_name": data[0].first_name,
"last_name": data[0].last_name,
"user_name": data[0].user_name,
- "user_phone": data[0].user_phone
+ "user_phone": data[0].user_phone,
+ "user_email": data[0].user_email
}
token = jwt_handler.generate_jwt(payload=result, lifetime=120) # generate token valid 60 mins
result["token"] = token # add token to user data
diff --git a/src/server/BreCal/impl/user.py b/src/server/BreCal/impl/user.py
index ece0d5f..699e4bf 100644
--- a/src/server/BreCal/impl/user.py
+++ b/src/server/BreCal/impl/user.py
@@ -27,7 +27,7 @@ def PutUser(schemaModel):
return json.dumps("no such record"), 404, {'Content-Type': 'application/json; charset=utf-8'}
# see if we need to update public fields
- if "first_name" in schemaModel or "last_name" in schemaModel or "user_phone" in schemaModel:
+ if "first_name" in schemaModel or "last_name" in schemaModel or "user_phone" in schemaModel or "user_email" in schemaModel:
query = "UPDATE user SET "
isNotFirst = False
for key in schemaModel.keys():
diff --git a/src/server/BreCal/schemas/model.py b/src/server/BreCal/schemas/model.py
index fdd6e94..905d412 100644
--- a/src/server/BreCal/schemas/model.py
+++ b/src/server/BreCal/schemas/model.py
@@ -180,6 +180,7 @@ class UserSchema(Schema):
first_name = fields.Str(Required=False, allow_none=True)
last_name = fields.Str(required=False, allow_none=True)
user_phone = fields.Str(required=False, allow_none=True)
+ user_email = fields.Str(required=False, allow_none=True)
old_password = fields.Str(required=False, allow_none=True)
new_password = fields.Str(required=False, allow_none=True)