1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-10-09 05:57:40 +02:00
bitwarden-browser/src/commands/login.command.ts

22 lines
597 B
TypeScript
Raw Normal View History

2018-05-12 21:12:28 +02:00
import * as program from 'commander';
import { AuthResult } from 'jslib/models/domain/authResult';
import { AuthService } from 'jslib/abstractions/auth.service';
2018-05-14 20:54:19 +02:00
import { Response } from '../models/response';
2018-05-13 03:24:28 +02:00
2018-05-14 20:54:19 +02:00
export class LoginCommand {
constructor(private authService: AuthService) { }
2018-05-12 21:12:28 +02:00
2018-05-13 06:19:14 +02:00
async run(email: string, password: string, cmd: program.Command) {
try {
const result = await this.authService.logIn(email, password);
2018-05-14 20:54:19 +02:00
// TODO: 2FA
return Response.success();
2018-05-13 06:19:14 +02:00
} catch (e) {
2018-05-15 17:08:55 +02:00
return Response.error(e);
2018-05-13 06:19:14 +02:00
}
2018-05-12 21:12:28 +02:00
}
}