-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create settings page where users can change their email and password. Throw error if something fails. Fix csv issues
- Loading branch information
1 parent
eb68334
commit 48a261b
Showing
9 changed files
with
84 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,7 +62,7 @@ Id,Name,Surname,Email,Username,Birthdate,DateCreated,Address,PhoneNumber | |
70,Glori,Snadden,[email protected],gsnadden1p,5/29/2018,3/1/2018,86 Spohn Trail,104-865-7034 | ||
71,Jaymee,Bayns,[email protected],jbayns1q,12/27/2017,7/30/2018,67105 Twin Pines Hill,568-814-2856 | ||
72,Giustina,Wilstead,[email protected],gwilstead1r,5/2/2018,6/4/2018,3340 Ronald Regan Lane,890-787-5413 | ||
73 ,LeilaStar ,Bruneton ,[email protected] ,lbruneton1s ,5/19/2018 ,10/8/2017 ,3952 Karstens Lane ,252-315-0574 | ||
73 ,LeilaStar ,Bruneton ,[email protected] ,lbruneton1s ,5/19/2018 ,10/8/2017 ,3952 KarstensLane ,252-315-0574 | ||
74,Rudolf,Hargraves,[email protected],rhargraves1t,2/18/2018,6/6/2018,43 Pond Street,739-541-4640 | ||
75,Edsel,McMechan,[email protected],emcmechan1u,10/10/2017,5/10/2018,0 Corscot Road,646-704-5446 | ||
76,Dorita,Mathes,[email protected],dmathes1v,9/23/2017,11/24/2017,391 Stone Corner Hill,438-619-3889 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
src/main/client/src/app/shared/settings/email-change.model.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import {FormGroup} from "@angular/forms"; | ||
|
||
export class EmailChange { | ||
newEmail: string; | ||
|
||
constructor(form: FormGroup) { | ||
this.newEmail = form.get('newEmail').value; | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
src/main/client/src/app/shared/settings/password-change.model.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import {FormGroup} from "@angular/forms"; | ||
|
||
export class PasswordChange { | ||
oldPassword: string; | ||
newPassword: string; | ||
newPasswordRepeat: string; | ||
|
||
constructor(form: FormGroup) { | ||
this.oldPassword = form.get('oldPassword').value; | ||
this.newPassword = form.get('newPassword').value; | ||
this.newPasswordRepeat = form.get('newPasswordRepeat').value; | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/main/client/src/app/shared/settings/settings.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import {Injectable} from "@angular/core"; | ||
import {RepoService} from "../repo/repo.service"; | ||
import {EmailChange} from "./email-change.model"; | ||
import {PasswordChange} from "./password-change.model"; | ||
|
||
@Injectable() | ||
export class SettingsService { | ||
constructor(private repoService: RepoService) { | ||
} | ||
|
||
updateEmail(dto: EmailChange) { | ||
this.repoService.put("profile/change-email/", dto) | ||
.subscribe(() => { | ||
}, error => console.log(error)); | ||
} | ||
|
||
updatePassword(dto: PasswordChange) { | ||
this.repoService.put("profile/change-pass/", dto) | ||
.subscribe(() => { | ||
}, error => console.log(error)); | ||
} | ||
} |
37 changes: 19 additions & 18 deletions
37
src/main/java/com/linkedin/converter/NotificationConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,34 @@ | ||
package com.linkedin.converter; | ||
|
||
import com.linkedin.entities.database.Notification; | ||
import com.linkedin.entities.database.User; | ||
import com.linkedin.entities.database.repo.UserRepository; | ||
import com.linkedin.entities.model.notifications.NotificationDto; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public class NotificationConverter { | ||
private final UserRepository userRepository; | ||
private final UserConverter userConverter; | ||
private final UserRepository userRepository; | ||
private final UserConverter userConverter; | ||
|
||
@Autowired | ||
public NotificationConverter(UserRepository userRepository, UserConverter userConverter){ | ||
@Autowired | ||
public NotificationConverter(UserRepository userRepository, UserConverter userConverter) { | ||
|
||
this.userRepository = userRepository; | ||
this.userConverter = userConverter; | ||
} | ||
this.userRepository = userRepository; | ||
this.userConverter = userConverter; | ||
} | ||
|
||
public NotificationDto toNotificationDto(Notification notification){ | ||
NotificationDto notificationDto = new NotificationDto(); | ||
notificationDto.setMessage(notification.getMessage()); | ||
notificationDto.setNotificationId(notification.getNotificationId()); | ||
notificationDto.setStatus(notification.getStatus()); | ||
notificationDto.setType(notification.getType()); | ||
notificationDto.setUser( userConverter.toUserSimpleDto( userRepository.findById(notification.getUserId()).orElse(null) )); | ||
notificationDto.setTargetUserId(notification.getTargetUserId()); | ||
notificationDto.setLikeCommentConnectionId(notification.getLikeCommentConnectionId()); | ||
public NotificationDto toNotificationDto(Notification notification) { | ||
NotificationDto notificationDto = new NotificationDto(); | ||
notificationDto.setMessage(notification.getMessage()); | ||
notificationDto.setNotificationId(notification.getNotificationId()); | ||
notificationDto.setStatus(notification.getStatus()); | ||
notificationDto.setType(notification.getType()); | ||
notificationDto.setUser(userConverter.toUserSimpleDto(userRepository.findById(notification.getUserId()).orElse(new User()))); | ||
notificationDto.setTargetUserId(notification.getTargetUserId()); | ||
notificationDto.setLikeCommentConnectionId(notification.getLikeCommentConnectionId()); | ||
|
||
return notificationDto; | ||
} | ||
return notificationDto; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters