rename user=>name
This commit is contained in:
@@ -35,13 +35,13 @@
|
|||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "Remote domain for check"
|
"description": "Remote domain for check"
|
||||||
},
|
},
|
||||||
"gitcheck.user": {
|
"gitcheck.name": {
|
||||||
"type":"string",
|
"type":"string",
|
||||||
"description": "Username for gitcheck domain"
|
"description": "user.name for gitcheck domain"
|
||||||
},
|
},
|
||||||
"gitcheck.email": {
|
"gitcheck.email": {
|
||||||
"type":"string",
|
"type":"string",
|
||||||
"description": "Email for gitcheck domain"
|
"description": "user.email for gitcheck domain"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,14 +4,14 @@ import { GitExtension } from './git';
|
|||||||
export async function activate() {
|
export async function activate() {
|
||||||
var conf = vscode.workspace.getConfiguration("gitcheck");
|
var conf = vscode.workspace.getConfiguration("gitcheck");
|
||||||
const domain = conf.get<string>("domain");
|
const domain = conf.get<string>("domain");
|
||||||
const user = conf.get<string>("user");
|
const name = conf.get<string>("name");
|
||||||
const email = conf.get<string>("email");
|
const email = conf.get<string>("email");
|
||||||
|
|
||||||
if (!vscode.workspace.workspaceFolders) {
|
if (!vscode.workspace.workspaceFolders) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(domain && user && email)) {
|
if (!(domain && name && email)) {
|
||||||
console.log("Missing config params");
|
console.log("Missing config params");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -27,7 +27,7 @@ export async function activate() {
|
|||||||
const pushUrl = remote.pushUrl;
|
const pushUrl = remote.pushUrl;
|
||||||
if (pushUrl && pushUrl.includes(domain)) {
|
if (pushUrl && pushUrl.includes(domain)) {
|
||||||
var gitConfig = await repository.getConfigs();
|
var gitConfig = await repository.getConfigs();
|
||||||
var gitUser:string = "";
|
var gitName:string = "";
|
||||||
var gitEmail:string = "";
|
var gitEmail:string = "";
|
||||||
gitConfig = gitConfig.filter( elem => {
|
gitConfig = gitConfig.filter( elem => {
|
||||||
return elem.key === "user.name" || elem.key === "user.email";
|
return elem.key === "user.name" || elem.key === "user.email";
|
||||||
@@ -39,7 +39,7 @@ export async function activate() {
|
|||||||
gitConfig.forEach(c => {
|
gitConfig.forEach(c => {
|
||||||
switch (c.key) {
|
switch (c.key) {
|
||||||
case "user.name":
|
case "user.name":
|
||||||
gitUser = c.value;
|
gitName = c.value;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "user.email":
|
case "user.email":
|
||||||
@@ -50,7 +50,7 @@ export async function activate() {
|
|||||||
console.log(c.key);
|
console.log(c.key);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (gitUser !== user || gitEmail !== email) {
|
if (gitName !== name || gitEmail !== email) {
|
||||||
vscode.window.showErrorMessage("Wrong user creds in git");
|
vscode.window.showErrorMessage("Wrong user creds in git");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user