Comments (7)
Maybe possible, the API has been just tested at dca9b62.
But Electron doesn't support any input dialog such as window.prompt
, so the app has to implement on its own.
from desktop.
Let me jump in here, I had solved the problem in a not-so-graceful but effective way once for a different app, perhaps this experience can come in handy (did spend some hours testing various libraries which refused to work before coming up with this):
var app = require('app');
var BrowserWindow = require('browser-window');
var prompt = require('sync-prompt').prompt;
var name = prompt('Username: ');
var password = prompt.hidden('Password: ');
app.on('login', function (event, webContents, request, authInfo, callback) {
event.preventDefault();
console.log("Replacing default auth behaviour.");
callback(name, password);
});
from desktop.
Thank you for feedback. I think It will work, however users have to use command-line and keep it opened.
Note: callback()
can be called asynchronously, so sync-prompt
might not be necessary. Then, sync-prompt
is a native module, so it's a little hard to compile release version. (On my environment, Windows 10 + Node 4.2.2 + VS2015 Update1, I could not compile sync-prompt
.)
from desktop.
readline-sync
might be nice for @mgielda's example. It looks JavaScript.
from desktop.
@yuya-oc indeed it works (sorry it took some time to answer) - so I agree, the updated snippet is:
var readlineSync = require('readline-sync'); //tested on readline-sync 1.4.1
var username = readlineSync.question('Username: ');
var password = readlineSync.question('Password: ', {
hideEchoBack: true // The typed text on screen is hidden by `*` (default).
});
app.on('login', function (event, webContents, request, authInfo, callback) {
event.preventDefault();
console.log("Replacing default auth behaviour.");
callback(username, password);
});
How should we proceed with that? There needs to be some config option for this I suppose. I agree that doing a graphical version later is a good idea but for now this would be good enough. Should we perhaps propose a pull request?
from desktop.
Closed by the commit message. This should not be closed yet.
from desktop.
Sorry! You are right of course. Habit from my own projects.
from desktop.
Related Issues (20)
- [Feature]: Add LanguageTool, spelling and grammar checker, support HOT 1
- [Bug]: Download location menu label in settings hard to read in dark mode
- Since I upgraded to 5.7.0 on my desktop, I only get a black screen HOT 15
- [Bug]: The title and taskbar doesn't match browser anymore HOT 2
- [Bug]: handleGetDesktopSources Blocked on wrong webContentsId HOT 4
- [Bug]: Mattermost apt repository GPG signing key is expired (today) HOT 11
- [Bug]: Missing notifications on Ubuntu 23 HOT 5
- [Bug]: Random Certificate Error HOT 3
- [Bug]: Linux desktop client keeps creating autostart file for Electron HOT 8
- Under Wayland, Mattermost should not draw extra window decorations if the compositor encourages client-side decorations
- [Bug]: linux x64 (non-arm) AppImage is missing (mattermost-desktop-5.8.0-linux-x86_64.AppImage) HOT 4
- [Bug]: Part of app window is showing on second monitor HOT 7
- [Bug]: No Sound alert and notification popup on Windows 10/Server 2016 v1607 (pre-creators update) HOT 6
- [Crash]: Ubuntu 24.04 LTS - Core dump exit-code 133 HOT 5
- [Bug]: Notification banners and sound are not played on macOS when FocusStatus permission is denied HOT 2
- [Bug]: Windows top bar (including 3 icons to minimize/increase size and close buttons) is showing css instead HOT 2
- [Bug]: Mattermost window keeps resizing each time after relaunch HOT 1
- [Bug]: Some download links are down for v5.8.1 HOT 2
- [bug]:Jitsi Meet does not have microphone and camera permissions in embedded mode, but it works fine in Chrome/Safari. HOT 2
- [Bug]: Layout issues when running under wayland
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from desktop.