Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

24
LINES

< > TinyBrain | #1005140 - GMail: Set user & password to use

JavaX source code [tags: use-pretranspiled] - run with: x30.jar - homepage

Libraryless. Click here for Pure Java version (2385L/17K/60K).

!7

p {
  veryBigConsole();
  print("Please enter gmail user name and press enter.");
  consoleSetInput(or(gmailDefaultUser(), "my.gmail.name@gmail.com"));
  S user = gmailGetHandle(readLine());
  gmailDefaultUser(user);
  print("OK, set to: " + user);
  print();
  print("Have password? " + yn(findGMailPasswordOpt(user) != null));
  
  print("Please type a password if you want to change it.");
  consoleSetInput("");
  S pass = trim(readLineHidden());
  if (nempty(pass)) {
    S name = gmailPasswordFileName(user);
    File file = findSecretFile(name);
    if (file == null)
      file = newFile(javaxSecretDir(), "GMail", name);
    saveTextFile(file, pass);
    print("Password saved!");
  }
}

download  show line numbers  debug dex   

Travelled to 3 computer(s): cfunsshuasjs, ddnzoavkxhuk, tvejysmllsmz

No comments. add comment

Snippet ID: #1005140
Snippet name: GMail: Set user & password to use
Eternal ID of this version: #1005140/9
Text MD5: fb71dd5326a684f9e099c856a184b589
Transpilation MD5: 668c287e35372717275a5aea0645e861
Author: stefan
Category: javax / gmail
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-09-14 00:20:30
Source code size: 722 bytes / 24 lines
Pitched / IR pitched: No / No
Views / Downloads: 100 / 96
Version history: 8 change(s)
Referenced in: [show]