Prasad108 / TutesMessanger

Tutes Messanger, Develpment to Serve Others
http://softus.in
8 stars 3 forks source link

Change username #68

Closed Prasad108 closed 6 years ago

Prasad108 commented 6 years ago
  1. Get input of current user name
  2. get input new username

check the current username in db

  1. if it is correct then
    • update the new username
    • show the success message to user

else

  1. ask user to enter correct current username
Prasad108 commented 6 years ago

tag @rahulnagure
check the issue and do it ASPA for any help please free to contact

Prasad108 commented 6 years ago

hi @rahulnagure check changeTUsername method in teacher controller for reference

Prasad108 commented 6 years ago

Hi @rahulnagure any update on change username or sms module ?

Prasad108 commented 6 years ago

U can send the data from angular $http to the MVC controller

NOTE: request data shuld be in JSON : eg. {"customerInfo":{"firstname":"xyz","lastname":"XYZ"}}

@RequestMapping(value = "/send", headers = "Accept=application/json", method = RequestMethod.POST)
public void sendEmails(@RequestBody HashMap<String, HashMap<String, String>> requestData) {

    HashMap<String, String> customerInfo = requestData.get("customerInfo");
    String firstname = customerInfo.get("firstname");
    String lastname = customerInfo.get("lastname");
    //TODO now do whatever you want to do.
}

@AbhishekPatwaCSE @rahulnagure

Prasad108 commented 6 years ago

angular js function will be something like this

$scope.changeUsername=function(){
    var sendData ={}
    sendData.currentUsername=$scope.CurrentUserName;
    sendData.NewUsername=$scope.NewUserName;

            $http(
                    {
                        url : "YOUR_URL",
                        contentType : 'application/json; charset=utf-8',
                        dataType : 'json',
                        method : "POST",
                        data : sendData,
                    }).then(function successCallback(response) {

                        //success callback

                   }, function errorCallback(response) {
                        // failure callback
                   });
            }

and JAVA controller method will be like this

@RequestMapping(value = "/YOUR_URL", headers = "Accept=application/json", method = RequestMethod.POST)
public void sendEmails(@RequestBody HashMap< HashMap<String, String> requestData) {

    HashMap<String, String> customerInfo = requestData.get("customerInfo");
    String currentUsername = requestData.get("currentUsername");
    String lastname = requestData.get("NewUsername");
    //TODO now do whatever you want to do.
}

check it out @AbhishekPatwaCSE

Prasad108 commented 6 years ago

hi @AbhishekPatwaCSE
u can get the response of the request in the request object u can get the status in response.data is the object u sent from controller u can get its status like response.data.status

for error


<div class="alert alert-block alert-danger fade in "  for="inputSuccess" ng-show="ExamCreateError">
                          <button data-dismiss="alert" class="close close-sm" type="button">
                              <i class="icon-remove"></i>
                          </button>
                        <strong>Error in saving Exam</strong>
                      </div>

check for ng-show variables u have to change there binary value in order to show or hide

AbhishekPatwaCSE commented 6 years ago

Hi @Prasad108

Teachers are able to Update the username successfully. Error message is also Display when username is not available in databases or current name and username is same.

Prasad108 commented 6 years ago

Hi @AbhishekPatwaCSE

Good Work You have correctly implemented the RestService in Controller.

however please pay attention to following point

  1. all the validation as mention in this issue (u can see them in issue description)
  2. also make the look and feel of the form more better

overall great work, u r learning quickly

Prasad108 commented 6 years ago

HTML pattern for :

Minimum eight characters, at least one uppercase letter, one lowercase letter, one number and one special character:

"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[$@$!%*?&])[A-Za-z\d$@$!%*?&]{8,}"

[]()https://stackoverflow.com/questions/19605150/regex-for-password-must-contain-at-least-eight-characters-at-least-one-number-a

tag : @AbhishekPatwaCSE