Help with md5


#1

hello, it’s my first time post on the forum.
and i;m sorry if my english bad.

I have login form as you can see bellow

login.html

<ion-content padding>
  <form (submit)="doLogin()">
    <ion-item>
      <ion-label stacked>Username</ion-label>
      <ion-input [(ngModel)]="loginData.username" name="username" type="text" placeholder="Username" ></ion-input>
    </ion-item>
    <ion-item>
      <ion-label stacked>Password</ion-label>
      <ion-input [(ngModel)]="loginData.password" name="password" type="password" placeholder="Password"></ion-input>
    </ion-item>
    <button ion-button block type="submit">
      Login
    </button>
  </form>

login.ts

import { Component } from '@angular/core';
import { NavController, LoadingController, ToastController } from 'ionic-angular';
import { AuthService } from '../../providers/auth-service';
import { TabsPage } from '../tabs/tabs';
import { RegisterPage } from '../register/register';

@Component({
  selector: 'page-login',
  templateUrl: 'login.html'
})
export class LoginPage {

  loading: any;
  loginData = { username:'', password:'' };
  data: any;

  constructor(public navCtrl: NavController, public authService: AuthService, public loadingCtrl: LoadingController, private toastCtrl: ToastController) {}

  doLogin() {
    this.showLoader();
    this.authService.login(this.loginData).then((result) => {
      this.loading.dismiss();
      this.data = result;
      localStorage.setItem('token', this.data.access_token);
      this.navCtrl.setRoot(TabsPage);
    }, (err) => {
      this.loading.dismiss();
      this.presentToast(err);
    });
  }

i want to password to be convert to md5 .

i tried many ways to convert to md5 but still no result.

please help.